package com.atlyc.common.web;

import org.hibernate.validator.constraints.Length;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @author lyc
 * @date 2018/7/20
 */
@RestController
@Validated
public class HelloController {

    private static final Logger log = LoggerFactory.getLogger(HelloController.class);

    @Value("${lycname}")
    private String name;

    @RequestMapping(value = "/")
    public String toString(@NotNull @Max(value = 6,message = "最多6")Integer id,@Length(max = 2) @RequestParam String name) {

        return "hello world"+name;
    }

    @RequestMapping(value = "/hello")
    public String toString() {

        return "hello world"+name;
    }
}
